<template>
  <div>
    <BasicModal
      width="80%"
      v-bind="$attrs"
      @register="registerModal"
      title="房源详情"
      @ok="handleSubmit"
    >
      <!-- <Checkbox v-model:checked="checked" class="che1" disabled> 隐藏地址 </Checkbox>
      <Checkbox v-model:checked="checked2" class="che2" disabled> 此VR为样板间或类似户型 </Checkbox> -->
      <Description @register="register" />
    </BasicModal>
  </div>
</template>
<script lang="ts">
import { defineComponent, ref } from 'vue';
import { BasicModal, useModalInner } from '/@/components/Modal';
import { Description, useDescription } from '/@/components/Description/index';
import { DetailsApi } from '/@/api/housingManag/index';
import { schema } from './data';
import { Checkbox } from 'ant-design-vue';
export default defineComponent({
  name: 'SalesUserModal',
  components: {
    BasicModal,
    Description,
    Checkbox,
  },
  emits: ['success', 'register'],
  setup() {
    const mockData = ref({});
    const checked = ref(true);
    const checked2 = ref(true);
    const [registerModal, { closeModal }] = useModalInner(async (data) => {
      mockData.value = {};
      const detail = await DetailsApi(data.record.id);
      mockData.value = { ...detail.data };
      checked.value = mockData._rawValue.addressFlag == 1 ? true : false;
      checked2.value = mockData._rawValue.vrFlag == 1 ? true : false;
    });
    const [register] = useDescription({
      data: mockData,
      column: 2,
      schema: schema,
    });
    async function handleSubmit() {
      console.log('确认事件', mockData);
      closeModal();
    }
    return {
      registerModal,
      register,
      closeModal,
      handleSubmit,
      schema,
      checked,
    };
  },
});
</script>
<style lang="less" scoped>
.che1 {
  position: absolute;
  left: 44%;
  top: 10%;
}
.che2 {
  position: absolute;
  left: 86%;
  top: 124%;
}
</style>